package com.cskaoyan.jdbc.crud;

import com.cskaoyan.jdbc.utils.JDBCUtils;
import com.mysql.jdbc.Driver;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * 创建日期: 2022/05/12 16:36
 *
 * @author ciggar
 */
public class UpdateJDBCDemo2 {

    public static void main(String[] args) throws SQLException {


        Connection connection = JDBCUtils.getConnection();

        Statement statement = connection.createStatement();

        // 3. 发送SQL语句
        int affectedRows = statement.executeUpdate("update stu set name = '孔二愣子',class='五班' where id = 4");


        // 4. 解析结果集
        System.out.println("affectedRows:" + affectedRows);


        JDBCUtils.close(connection,statement,null);

    }
}
